.class public Lcom/brixd/niceapp/util/PushUtils;
.super Ljava/lang/Object;
.source "PushUtils.java"


# static fields
.field public static final TAG:Ljava/lang/String; = "PushUtils"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 14
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static getMetaValue(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
    .registers 8
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "metaKey"    # Ljava/lang/String;

    .prologue
    .line 19
    const/4 v2, 0x0

    .line 20
    .local v2, "metaData":Landroid/os/Bundle;
    const/4 v1, 0x0

    .line 21
    .local v1, "apiKey":Ljava/lang/String;
    if-eqz p0, :cond_6

    if-nez p1, :cond_8

    .line 22
    :cond_6
    const/4 v3, 0x0

    .line 36
    :goto_7
    return-object v3

    .line 25
    :cond_8
    :try_start_8
    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v3

    .line 26
    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v4

    const/16 v5, 0x80

    .line 25
    invoke-virtual {v3, v4, v5}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;

    move-result-object v0

    .line 27
    .local v0, "ai":Landroid/content/pm/ApplicationInfo;
    if-eqz v0, :cond_1a

    .line 28
    iget-object v2, v0, Landroid/content/pm/ApplicationInfo;->metaData:Landroid/os/Bundle;

    .line 30
    :cond_1a
    if-eqz v2, :cond_20

    .line 31
    invoke-virtual {v2, p1}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;
    :try_end_1f
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_8 .. :try_end_1f} :catch_22

    move-result-object v1

    .end local v0    # "ai":Landroid/content/pm/ApplicationInfo;
    :cond_20
    :goto_20
    move-object v3, v1

    .line 36
    goto :goto_7

    .line 33
    :catch_22
    move-exception v3

    goto :goto_20
.end method

.method public static hasBind(Landroid/content/Context;)Z
    .registers 5
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 41
    .line 42
    invoke-static {p0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 43
    .local v1, "sp":Landroid/content/SharedPreferences;
    const-string v2, "bind_flag"

    const-string v3, ""

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 44
    .local v0, "flag":Ljava/lang/String;
    const-string v2, "ok"

    invoke-virtual {v2, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_16

    .line 45
    const/4 v2, 0x1

    .line 47
    :goto_15
    return v2

    :cond_16
    const/4 v2, 0x0

    goto :goto_15
.end method

.method public static setBind(Landroid/content/Context;Z)V
    .registers 6
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "flag"    # Z

    .prologue
    .line 51
    const-string v1, "not"

    .line 52
    .local v1, "flagStr":Ljava/lang/String;
    if-eqz p1, :cond_6

    .line 53
    const-string v1, "ok"

    .line 56
    :cond_6
    invoke-static {p0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v2

    .line 57
    .local v2, "sp":Landroid/content/SharedPreferences;
    invoke-interface {v2}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 58
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    const-string v3, "bind_flag"

    invoke-interface {v0, v3, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 59
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 60
    return-void
.end method

.method public static startPush(Landroid/content/Context;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 64
    const/4 v0, 0x0

    const-string v1, "api_key"

    invoke-static {p0, v1}, Lcom/brixd/niceapp/util/PushUtils;->getMetaValue(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-static {p0, v0, v1}, Lcom/baidu/android/pushservice/PushManager;->startWork(Landroid/content/Context;ILjava/lang/String;)V

    .line 65
    return-void
.end method

.method public static stopPush(Landroid/content/Context;)V
    .registers 1
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 68
    invoke-static {p0}, Lcom/baidu/android/pushservice/PushManager;->stopWork(Landroid/content/Context;)V

    .line 69
    return-void
.end method
